package com.ydd.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ydd.entity.YddAdvimg;
import com.github.pagehelper.Page;
import com.ydd.dto.SelectAllDTO;
import com.ydd.dto.YddLinkDTO;
import com.ydd.entity.YddLink;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import com.ydd.vo.YddLinkVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author itcast
 * @since 2023-05-15
 */
public interface YddLinkMapper extends BaseMapper<YddLink> {

    @Select("select * from ydd_link")
    public List<YddLink> yddList();

    /**
     * 查询所有友情链接
     * @param selectAllDTO
     * @return
     */
    @Select("Select * from ydd_link where type = #{type}")
    Page<YddLink> selectAllLink(SelectAllDTO selectAllDTO);

    /**
     * 修改友情链接
     * @param yddLinkDTO
     * @return
     */
    void updateLink(YddLinkDTO yddLinkDTO);

    /**
     * 新增友情链接
     * @param yddLink
     */
    @Insert("insert into ydd_link values(null,#{title},#{url},#{des},#{img},#{type},#{defaultData})")
    void addLink(YddLink yddLink);

    /**
     * 删除友情链接
     * @param id
     */
    @Delete("delete from ydd_link where id = #{id}")
    void deleteLinkById(String id);

    /**
     * qbs
     * 链接详情
     * @param id
     * @return
     */
    @Select("select * from ydd_link where id = #{id}")
    YddLinkVO rowInfo(String id);

}
